<!DOCTYPE html>
<html>
<head>
    <meta charset="utf-8">
    <title>ECharts</title>
    <!-- 引入 echarts.js -->
    <script src="echarts.min.js"></script>
	<link rel="stylesheet" type="text/css" href="../layui/css/layui.css" />
	<link rel="stylesheet" type="text/css" href="../font-awesome-4.7.0/css/font-awesome.css" />
</head>
<body>
	<div style="display: flex;">
	<h1><a href="regionalManager .html"><i class="fa fa-chevron-left" aria-hidden="true"></i></a></h1>&nbsp&nbsp&nbsp&nbsp&nbsp
	<button class="layui-btn layui-btn-normal" lay-submit lay-filter="formDemo" onclick="selectCount()">更新数据</button>
	</div>
    <!-- 为ECharts准备一个具备大小（宽高）的Dom -->
    <div id="main" style="width: 600px;height:400px;"></div>
				<script src="../layui/layui.js" type="text/javascript" charset="utf-8"></script>
    <script type="text/javascript">
        // 基于准备好的dom，初始化echarts实例
		var array3=[];
	var $=layui.$;
	function selectCount (){

		$.ajax({
			url:"http://127.0.0.1:8080/repair/regional/selectCount",
			method:"get",
			dataType:"json",
			success: function(data) {
				if (data.code == 200) {
					//表示添加成功
			
					//弹出添加成功的提示
					layui.layer.msg(data.msg);
					
	
				array3=data.data;

				
				}
				if (data.code == 500) {
					//表示添加失败
					layui.layer.msg(data.msg);
				}
			}
			
		
		})
		

		      
		var myChart = echarts.init(document.getElementById('main'));
		
			
		
		// 指定图表的配置项和数据
		var option = {
		    title: {
		        text: '图表统计'
		    },
		    tooltip: {},
		    legend: {
		        data:['销量']
		    },
		    xAxis: {
		        data: ["一号楼","二号楼","三号楼","四号楼","五号楼","六号楼"]
		    },
		    yAxis: {},
		    series: [{
		        name: '销量',
		        type: 'bar',
		        data:array3
		    }]
		};
		
		// 使用刚指定的配置项和数据显示图表。
		myChart.setOption(option);
		
		
		
		
		
		
		
	
	}
		
		
    </script>

</body>
</html>